scVelo builds a “velocity graph” based on a similarity matrix. Entries in the similarity matrix are the cosine similarity between the velocity vector and the cell difference vector. Additionally, scVelo computes a transition matrix, in which entries represent the probabilities of cell–>cell transitions. These probabilities are calculated based on the similarities from above. Here, we want to build a graph using these two matrices as adjacency matrices and compare the resulting force-directed embeddings to the embedding that we build using the composite distance function.
Use the reticulate package to use scVelo from within R:
Extract count data..
Filter genes
Downsample cells to make things easier
Normalize for dimensional reduction
## Warning in if (!class(counts) %in% c("dgCMatrix", "dgTMatrix")) {: the condition
## has length > 1 and only the first element will be used
## Converting to sparse matrix ...
## Normalizing matrix with 1232 cells and 8724 genes
Dimensional reduction
Run velocyto on panc data
Scores of observed and projected states in PC space
Graph visualization on subset of cells from PC coordinates
1232 cells
Run scvelo velocity on same subset used to make fdg graph
Make graph